package it.low.game.server;

import it.low.game.server.util.ServerLogManager;

public class Server {
	
	private static ServerEngine serverEngine = null;
	private static ServerNetworking serverNetworking = null;
	public static boolean running = false;
		
	public static void main(String[] args) {
		try{	
			ServerLogManager.logMsg("**** START SERVER ****");		
			init();		
			start();		
		}catch(Exception e){
			e.printStackTrace();
		}

	}
	
	public static void init(){
		ServerLogManager.logMsg("call Server.init()");
		initEngine();
		initNetworking();
		
	}
	
	public static void start(){
		ServerLogManager.logMsg("call Server.start()");
		running = true;		
		startEngine();
		startNetworking();
	}
	
	private static void initEngine(){
		ServerLogManager.logMsg("call Server.initEngine()");
		serverEngine = new ServerEngine();
		serverEngine.init();		
	}
	
	private static void startEngine(){
		ServerLogManager.logMsg("call Server.startEngine()");
		serverEngine.start();
	}
	
	private static void initNetworking(){
		ServerLogManager.logMsg("call Server.initNetworking()");
		serverNetworking = new ServerNetworking();
		//serverNetworking.init();
	}
	
	private static void startNetworking(){
		ServerLogManager.logMsg("call Server.startNetworking()");
		serverNetworking.start();
	}
	

}
